<?php

/* 
 * The include path may change 
 * depending on PHPCodeProvider.php location. 
 */

include_once 'Classes/PHPCodeProvider.php';

/*
 * Create an instance of the CodeGeneratorOptions class
 * using the default options for code generation.
 * It is possible to change the bracing style
 * and also to omit blank lines between the lines.
 */

$options = new CodeGeneratorOptions();

/*
 * Create an instance of the IndentedTextWriter.
 * After the generateCodeFromStatement call
 * $writer will hold the generated code.
 */

$writer = new IndentedTextWriter();

/*
 * Create an AssignStatement instance
 * AssignStatement is a Statement child class
 * so it can be used with PHPCodeProvider::generateCodeFromStatement()
 */

$statement = new AssignStatement(
    new VariableReferenceExpression('notInPlace'), 
    new PrimitiveExpression(0));

$provider = new PHPCodeProvider();
$provider->generateCodeFromStatement($statement, $writer, $options);

/*
 * Output the generated code using $writer->get_String();
 */

echo 
    '<pre>' . str_replace(
        '<br />', '', highlight_string($writer->get_String(), true)) .
    '<pre/>';

/*
 * The output should be:
 * 
 * $notInPlace = 0;
 * 
 */

?>
